package presentacion;

import java.awt.BorderLayout;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JPanel;


import presentacion.Cliente.VentanaClientes;
import presentacion.Color.VentanaColor;
import presentacion.Marcas.VentanaMarcas;
import presentacion.Modelo.VentanaModelo;
import presentacion.Motor.VentanaMotor;
import presentacion.Vehiculo.VentanaVehiculo;
import presentacion.Venta.VentanaVentas;

public class Main {
	

	public static void main(String[] args) {

		JFrame principal = new JFrame("CAR DEALER");
		principal.setLayout(new BorderLayout());

		//Botones operativos
		JButton marcas = new JButton("MARCA");
		JButton modelo = new JButton("MODELO");
		JButton motor = new JButton("MOTOR");
		JButton colors = new JButton("COLOR");
		JButton vehiculo = new JButton("VEHICULO");
		JButton vender = new JButton("VENTAS");
		JButton cliente = new JButton("CLIENTES");
		
		//Panel modificaciones
		JPanel car = new JPanel();
		car.setLayout(new GridLayout(2,2));
		car.add(marcas);
		car.add(modelo);
		car.add(motor);
		car.add(colors);

		//Panel de gestion
		JPanel gestion = new JPanel();
		gestion.setLayout(new GridLayout(1,2));
		gestion.add(vender);
		gestion.add(cliente);
		
		principal.add(vehiculo, BorderLayout.PAGE_START);
		principal.add(car, BorderLayout.CENTER);
		principal.add(gestion, BorderLayout.PAGE_END);

		
		//ActionListener
		
		marcas.addActionListener(new ActionListener() {					
			@Override
			public void actionPerformed(ActionEvent arg0) {
				new VentanaMarcas();
						
			}
		});
		
		modelo.addActionListener(new ActionListener() {					
			@Override
			public void actionPerformed(ActionEvent arg0) {
				new VentanaModelo();
						
			}
		});
		
		motor.addActionListener(new ActionListener() {					
			@Override
			public void actionPerformed(ActionEvent arg0) {
				new VentanaMotor();
						
			}
		});

		colors.addActionListener(new ActionListener() {					
			@Override
			public void actionPerformed(ActionEvent arg0) {
				new VentanaColor();
						
			}
		});
		
		cliente.addActionListener(new ActionListener() {
			@Override
			public void actionPerformed(ActionEvent arg0) {
				new VentanaClientes();						
			}
		});	
		
		vehiculo.addActionListener(new ActionListener() {					
			@Override
			public void actionPerformed(ActionEvent arg0) {
				new VentanaVehiculo();							
			}
		});		
		
		
		vender.addActionListener(new ActionListener() {					
			@Override
			public void actionPerformed(ActionEvent arg0) {
				new VentanaVentas();							
			}
		});	
		
		principal.setVisible(true);
		principal.setSize(500, 450);
		principal.setLocationRelativeTo(null);
		principal.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
	}

}
